﻿using Shop.RemoteModel.LogisticsConfig;
using Shop.RemoteModel.LogisticsConfig.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class LogisticsConfigEvent : IRpcApiService
    {
        private readonly ILogisticsConfigService _Service;

        public LogisticsConfigEvent (ILogisticsConfigService service)
        {
            this._Service = service;
        }

        public long AddLConfig (AddLConfig add)
        {
            return this._Service.Add(add.Datum);
        }

        public LogisticsPrice CalculateLPrice (CalculateLPrice obj)
        {
            return this._Service.CalculatePrice(obj.Datum);
        }

        public void DeleteLConfig (DeleteLConfig obj)
        {
            this._Service.Delete(obj.Id);
        }

        public LogisticsConfigDatum GetLConfig (GetLConfig obj)
        {
            return this._Service.Get(obj.Id);
        }

        public PagingResult<LogisticsConfigDatum> QueryLConfig (QueryLConfig query)
        {
            return this._Service.Query(query.QueryParam, query.ToBasicPage());
        }
        public LogisticsConfigDatum[] GetLConfigs (GetLConfigs obj)
        {
            return this._Service.Gets(obj.Query);
        }
        public bool SetLConfig (SetLConfig set)
        {
            return this._Service.Set(set.Id, set.Datum);
        }

        public bool SetLConfigIsEnable (SetLConfigIsEnable set)
        {
            return this._Service.SetIsEnable(set.Id, set.IsEnable);
        }
    }
}
